from base.base_action import Base

class Authorize_Object(Base):
    #同意隐私
    def privacy_agree_button(self):
        return '//android.widget.TextView[@resource-id="com.dangdang.buy2:id/tv_sure"]'
    #同意授权
    def authorize_agree_button(self):
        return '//android.widget.TextView[@resource-id="com.dangdang.buy2:id/tv_sure"]'
    #新人专享
    def ad_close_button(self):
        return '//android.widget.TextView[@resource-id="com.dangdang.buy2:id/dialog_cancel_tv"]'

class Home_object(Base):
    # 放大镜
    def home_search_bar_button(self):
        return '//android.widget.TextView[@text=""]'
    def home_search_bar_textview(self):
        return '//android.widget.EditText[@resource-id="com.dangdang.buy2:id/et_search"]'

if __name__=='__main__':
    #1.将元素封装到类中，导入类就可以直接获取元素
    from base.base_object import Authorize_Object
    print(Authorize_Object().privacy_agree_button())
    print(Authorize_Object().authorize_agree_button())
    print(Authorize_Object().ad_close_button())
    #2.其它类继承Authorize_Object,就可以继承页面上所有的元素
    class abc(Authorize_Object):
        pass
    print(abc().authorize_agree_button())